package com.gin.pixiv.callback

import com.gin.pixiv.main.Pixiv
import java.awt.Desktop
import java.io.File

class WriteFileCallback<T> : PixivCallback<T>() {
    override fun onSuccess(body: T?) {
        if (body == null) {
            return
        }
        val file = File("d:/tempJson/${System.currentTimeMillis()}.json")
        file.parentFile.mkdirs()
        Pixiv.MAPPER.writeValue(file, body)
        Desktop.getDesktop().open(file);
    }
}